package com.huilian.iotbox.admin.controller;

import com.huilian.iotbox.admin.service.DeviceBuyOrderService;
import com.huilian.iotbox.admin.service.UserService;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.controller.BaseController;
import com.huilian.iotbox.data.dto.DeviceBuyOrderDto;
import com.huilian.iotbox.data.enums.RoleEnum;
import com.huilian.iotbox.data.vo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * @author 谢洛涛
 * @date 2021/9/7 16:21
 */
@RestController
@RequestMapping("/api/deviceBuyOrder")
public class DeviceBuyOrderController extends BaseController {
    @Autowired
    private DeviceBuyOrderService deviceBuyOrderService;
    @PostMapping("/notice")
    public String payNotice(HttpServletRequest request) throws Exception {
        try {
            return deviceBuyOrderService.payQrCodeNotify(request);
        } catch (Exception e) {
            return "fail,充值回调出错";
        }
    }
    /**
     * 大额转账回调
     */
    @PostMapping("/largeTransferNotice")
    public String largeTransferNotice(HttpServletRequest request) throws IOException {
        return deviceBuyOrderService.largeTransferNotice(request);
    }


}
